<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="模板分类" bodyClass="white-bg" libs=["bootstrapSelect"]/>
<div class="wrapper wrapper-content ibox-content">
    <@f.form id="task-form-complete" class="form-horizontal">
    <h4 class="form-header h4"><@ctx.i18n text = "基本信息"/></h4>
    <input class="form-control" name="id" value="${configure.id}" type="hidden"  placeholder="请填写模板分类名称(必填)" >
    <div class="row">
        <div class="col-sm-12">
            <div class="form-group">
                <label class="col-sm-4 control-label"><@ctx.i18n text = "父类"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <!--<input class="form-control" name="equipmentType" value="" type="text"   >-->

                    <@f.treeselect  name="parentId" boxTitle="请选择父类"  url="pms/configure/treeData" value="${configure.parentId?default('')}"
                    labelValue="${configure.parentName?default('')}" correlationId="id" isSelectParent=true  placeholder="请选择父类(没有则不选择)"/>

                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "分类名称"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="configureType" value="${configure.configureType?default('')}" type="text"  placeholder="请填写分类名称(必填)" >
                    </div>
                </div>
            </div>
        </div>

    </div>



</@f.form>
<div class="hr-line-dashed"></div>
<div class="row" style="text-align: center;" id="_addTab">
    <!--<button type="button" class="btn btn-sm btn-primary" onclick="opt.form.submit()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;-->
    <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;
    <button type="button" class="btn btn-sm btn-danger" onclick="opt.modal.closeTab()"><i class="fa fa-reply-all"></i><@ctx.i18n text = "关闭"/></button>
</div>

<@footer>
<script type="text/javascript">
    var prefix = baseURL + "pms/configure";

    $('#tipBut button').click(function(){
        $('#comment').text($(this).text())
    });

    $("#task-form-complete").validate({
        focusCleanup: true
    });

    function tableCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        if(id == "projectName"){
            console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
            console.log(nodes.table[0]);
            var data = nodes.table[0];

            $("input[name=region]").val(data.region);

        }
    }

    $(function () {
        $("#t").click("input", function () {
            //在输入框中打印输入的值
            console.log("111111111111111111")
            opt.modal.openTab("规格",prefix + "/addfrom");
            // opt.layer.open({
            //     type: 1,
            //     area: ['700px', '400px'],
            //     title: '<i class="fa fa-upload"></i> 添加规格 ',
            //     shade: 0.3,
            //     shadeClose: true,
            //     resize: false,
            //     scrollbar: true,
            //     content: opt.template('tt'),
            // });

        });

        $("#").click("input", function () {
            //在输入框中打印输入的值
            console.log("111111111111111111")
            opt.modal.openTab("规格",prefix + "/addfrom");
            // opt.layer.open({
            //     type: 1,
            //     area: ['700px', '400px'],
            //     title: '<i class="fa fa-upload"></i> 添加规格 ',
            //     shade: 0.3,
            //     shadeClose: true,
            //     resize: false,
            //     scrollbar: true,
            //     content: opt.template('tt'),
            // });

        });
    });

    function tableCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        console.log(id)
        console.log("aaaaaaaaaaaaaaa")

        if(id == "testType"){
            console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
            console.log(nodes.table[0]);
            var data = nodes.table[0];
            $("input[name=buildIphone]").val(data.iphone);
            $("input[name=buildCode]").val(data.userCode);
        }





    }


    function submitHandler() {

        //  var arrivalAmount= parseFloat($('input[name="arrivalAmount"]').val());
        //  var claimAmount= parseFloat($('input[name="claimAmount"]').val());
        //  console.log(arrivalAmount);
        //  console.log(claimAmount);
        //  console.log(claimAmount>arrivalAmount);
        // if(claimAmount>arrivalAmount){
        //   //  alert("已认领金额不能大于到账金额");
        //   return  opt.modal.alertWarning("已认领金额不能大于到账金额");
        // }

        if (opt.validate.form()) {
            opt.operate.saveTab(prefix + "/edit", $('#task-form-complete').serialize());
        }
    }
    function teps() {
        console.log("111111111111111111")

    }
    var j=1;
    function addtr(){
        console.log("111111111");
        var tableobj =document.getElementById("s");
        console.log(tableobj);
        var trobj =document.createElement("div");
        var tdobj = document.createElement("input");
        // for(var i=0;i<4;i++)
        // {
        //     var tdobj=document.createElement("td");
        //     tdobj.innerHTML=j++;
        //     trobj.appendChild(tdobj);
        // }
        trobj.appendChild(tdobj);
        tableobj.appendChild(trobj);
    }

</script>

<script id="tt" type="text/template">
    <form id="inputForm" method="post" enctype="multipart/form-data" class="form-horizontal mt20 mb10">
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><@ctx.i18n text = "种类"/>：</label>
                    <div class="col-sm-6">
                        <!--<div class="input-group date">-->
                        <!--&lt;!&ndash;<span class="input-group-addon"><i class="fa fa-calendar"></i></span>&ndash;&gt;-->
                        <!--<input class="form-control"    name="type" value="" type="text" placeholder="种类(不是必填)"  >-->
                        <!--&lt;!&ndash;<input type="button" onclick="" value="添加">  onchange="tep()"&ndash;&gt;-->
                        <!--</div>-->

                    </div>
                </div>
            </div>
        </div>
        <!--<div class="row">-->
        <!--<div class="col-sm-12">-->
        <!--<div class="form-group">-->
        <!--<label class="col-sm-4 control-label"><@ctx.i18n text = "规格"/>：</label>-->
        <!--<div class="col-sm-6">-->
        <!--<div class="input-group date">-->
        <!--<input class="form-control"   name="type1" value="" type="text" placeholder="规格(不是必填)"  >-->
        <!--</div>-->
        <!--</div>-->
        <!--</div>-->

        <!--</div>-->

        <!--</div>-->
        <!--<div class="row">-->
        <!--<div class="col-sm-12">-->
        <!--<div class="form-group">-->
        <!--<label class="col-sm-4 control-label"><@ctx.i18n text = "直径"/>：</label>-->
        <!--<div class="col-sm-6">-->
        <!--<div class="input-group date">-->
        <!--<input class="form-control"   name="type2" value="" type="text" placeholder="直径(不是必填)"  >-->
        <!--</div>-->
        <!--</div>-->
        <!--</div>-->

        <!--</div>-->

        <!--</div>-->
        <!--<div class="row">-->
        <!--<div class="col-sm-12">-->
        <!--<div class="form-group">-->
        <!--<label class="col-sm-4 control-label"><@ctx.i18n text = "其他"/>：</label>-->
        <!--<div class="col-sm-6">-->
        <!--<div class="input-group date">-->
        <!--<input class="form-control"   name="type3" value="" type="text" placeholder="其他(不是必填)"  >-->
        <!--</div>-->
        <!--</div>-->

        <!--</div>-->

        <!--</div>-->


        <div class="row" style="text-align: center;" id="_addTab1">
            <!--<button type="button" class="btn btn-sm btn-primary" onclick="opt.form.submit()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;-->
            <button type="button" class="btn btn-sm btn-primary" onclick="teps()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="opt.modal.close()"><i class="fa fa-reply-all"></i><@ctx.i18n text = "关闭"/></button>
        </div>
    </form>

</script >

</@footer>
</@pageTheme>